Add script to generate missing async tests for PGMQOperation using CST#39
Merged
jason810496 merged 7 commits intoJan 6, 2026
Conversation
Copilot
AI
changed the title
[WIP] Add complete missing test for operation using CST approach
Add script to generate missing async tests for PGMQOperation using CST
Jan 5, 2026
da8aba2 to
9e76606
Compare
83cbc9b to
7f6a9c1
Compare
Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output.
* Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>
…roach Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
…ping Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
7f6a9c1 to
86cd6a3
Compare
jason810496
added a commit
that referenced
this pull request
Jan 6, 2026
* Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Add script to generate missing async methods for PGMQOperation (#37) * Initial plan * Add compelete_missing_async_methods_for_operation.py script and operation_ast helper Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix path resolution bug in operation_ast.py Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Address code review feedback: improve docstring handling and remove unnecessary method Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Improve docstring handling robustness with better length checks Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix queue await error * Add script to generate missing async tests for PGMQOperation using CST (#39) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Initial plan * Add compelete_missing_test_for_operation.py script with CST-based approach Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix code review feedback: remove redundant code and use Tuple from typing Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Finalize test_operation * Fix _check_pg_partman_ext naming --------- Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Add script to generate missing async tests using CST transformations (#38) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Initial plan * Add complete_missing_test_for_queue.py script with CST-based approach Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Apply ruff formatting to test generation scripts Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Address code review feedback: fix path resolution, type hints, and documentation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix missing async replacment for compelete test queue * Fix imports for async fixtures --------- Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Unifing script name for queue * Add missing async test methods for queue, fix check_pg_partman_ext --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added
scripts/compelete_missing_test_for_operation.pyto automatically generate missing async test functions forPGMQOperationclass. The script uses libcst for AST-based code transformations, following the same pattern ascompelete_missing_async_methods.py.Changes
Main script:
scripts/compelete_missing_test_for_operation.pytests/test_operation.pyto identify sync tests lacking async counterpartsUtility module:
scripts/scripts_utils/operation_test_ast.pyAsyncTestTransformer: Transforms sync test functions to asyncwith→async withfor session context managersawaittoPGMQOperationmethod calls and appends_asyncsuffixget_session_maker→get_async_session_makerin parameters and callsTestFunctionVisitor: Collects test functions and identifies missing async testsFillMissingTestsTransformer: Inserts generated tests with@pytest.mark.asynciodecoratorsExample Transformation
Status
Checklist
pre-commitwithruff)✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.